<template>
  <div class="main-container">
    <el-container class="el-container">
      <el-aside :width="isExpand ? '210px' : '65px'" class="aside">
        <mainmenu :is-expand="isExpand" />
      </el-aside>
      <el-container>
        <el-header height="70px">
          <mainheader @resolve-expand="handleExpand"></mainheader>
        </el-header>
        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts" setup>
import mainheader from './c-header/mainheader.vue'
import mainmenu from './c-menu/mainmenu.vue'
import { ref } from 'vue'

const isExpand = ref(true)

function handleExpand(expand: boolean) {
  isExpand.value = expand
}
</script>

<style scoped lang="scss">
.main-container {
  width: 100%;
  height: 100vh;
  background-color: #f2f2f2;

  .el-container {
    width: 100%;
    height: 100%;

    .el-aside {
      transition: width 0.3s ease;
      &::-webkit-scrollbar {
        display: none;
      }
    }

    .aside {
      height: 100%;
      background-color: white;
    }

    .el-container {
      padding-left: 20px;
      .el-header {
        border-radius: 0 0 0 5px;
        background-color: white;
      }

      .el-main {
        margin-top: 20px;
        background-color: white;
        border-radius: 5px 0 0 0;
      }
    }
  }
}
</style>
